package com.csweimei.rentmanagementtreasure.enterprise.viewModel;

import static com.csweimei.rentmanagementtreasure.base.AppConfig.BUNDLE_KEY;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.base.AppConfig;
import com.csweimei.rentmanagementtreasure.enterprise.act.VipActivity;
import com.csweimei.rentmanagementtreasure.http.entity.CustomerCenterBean;
import com.csweimei.rentmanagementtreasure.tenant.ui.act.customer.CustomerInfoActivity;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.utils.ToastUtils;

public class CCItemCVM extends MultiItemViewModel {
    public CCItemCVM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
    }

    public ObservableField<CustomerCenterBean.DataDTO.CListDTO> info = new ObservableField<>();

    public void setData(CustomerCenterBean.DataDTO.CListDTO d) {
        info.set(d);
    }

    public BindingCommand lookClick = new BindingCommand(() -> {
        if (AppConfig.isEntVip()){
            Bundle intent = new Bundle();
            intent.putString(BUNDLE_KEY,info.get().getId()+"");
            intent.putString(AppConfig.BUNDLE_KEY2,"ent");
            viewModel.startActivity(CustomerInfoActivity.class,intent);
        }else {
            ToastUtils.showShort("您还未开通企业服务，请前往购买相关服务");
            viewModel.startActivity(VipActivity.class);
        }


    });


}
